import os, sys
from spreadsheetdb import GoogleSpreadsheet
import spreadsheetdb.uoitdoc as uoitdoc
from pprint import pprint
from sqlite3 import connect
from 
(username, password, root) = sys.argv[1:4]

google = GoogleSpreadsheet(username, password)
accounts = uoitdoc.listaccounts(google)

for name, account in accounts.items():
  cache = os.path.join(root, name, "data.json")
  data = uoitdoc.loadpages(google,    # forcehtml silences the exception
         account, cache, forcehtml=1) # if data is cached
